/* 
 * File:   fieldconstantstest.cpp
 * Author: dolphinigle
 *
 * Created on March 11, 2011, 1:31 PM
 */

#include <stdlib.h>
#include "gtest/gtest.h"
#include "gtesthelper.hpp"
#include "fieldconstants.hpp"

TEST(FieldConstantsTest, ConsistentFieldSize) {
  EXPECT_TRUE(FieldConstants::getRowCount() == (int)FieldConstants::getMap().size());
  EXPECT_TRUE(FieldConstants::getRowCount() > 0);
  EXPECT_TRUE(FieldConstants::getColumnCount() > 0);
  for (int i = 0; i < FieldConstants::getRowCount(); ++i) {
    EXPECT_EQ(FieldConstants::getColumnCount(), (int)FieldConstants::getMap()[i].size());
  }

  for (int i = 0; i < FieldConstants::getDropBoxesCount(); ++i) {
    for (int j = 0; j < FieldConstants::getDropBoxesCount(); ++j) {
      if (i == j) {
        EXPECT_EQ(FieldConstants::getDropBoxXCoordinate(i),
                  FieldConstants::getDropBoxXCoordinate(j));
        EXPECT_EQ(FieldConstants::getDropBoxYCoordinate(i),
                  FieldConstants::getDropBoxYCoordinate(j));
      } else {
        EXPECT_TRUE(
                (FieldConstants::getDropBoxXCoordinate(i) !=
                FieldConstants::getDropBoxXCoordinate(j)) ||
                (FieldConstants::getDropBoxYCoordinate(i) !=
                FieldConstants::getDropBoxYCoordinate(j)));
      }
    }
  }

  GTestHelper::expectStrictlyBetween(FieldConstants::getTeleportXFromShop(),
          0, FieldConstants::getColumnCount());
  GTestHelper::expectStrictlyBetween(FieldConstants::getTeleportYFromShop(),
          0, FieldConstants::getRowCount());
  GTestHelper::expectStrictlyBetween(FieldConstants::getTeleportXFromHouse(),
          0, FieldConstants::getColumnCount());
  GTestHelper::expectStrictlyBetween(FieldConstants::getTeleportYFromHouse(),
          0, FieldConstants::getRowCount());
}

